<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
//response.sendRedirect("common/login");
%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>CwLinkList</title>
			<script type="text/javascript" src="${path }/resource/js/jquery-1.8.3.min.js"></script>
			<script type="text/javascript" src="${path }/resource/js/mytools.js"></script>
			<script type="text/javascript" src="${path }/resource/layer/layer.js"></script>
			<script type="text/javascript" src="${path }/resource/layui/layui.js" ></script>
			<link rel="stylesheet" href="${path }/resource/layui/css/layui.css" />
	</head>
	<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>表格风格表单</legend>
</fieldset>

<form class="layui-form layui-form-pane" id="searchFrom">
<div class="layui-form-item" >
    <div class="layui-inline">
     <label class="layui-form-label">id:</label>
     <div class="layui-input-inline">
		<input type="text"  class="layui-input" autocomplete="off" name="id" />
	 </div>
  </div>	
    <div class="layui-inline">
     <label class="layui-form-label">title:</label>
     <div class="layui-input-inline">
		<input type="text"  class="layui-input" autocomplete="off" name="title" />
	 </div>
  </div>	
    <div class="layui-inline">
     <label class="layui-form-label">link:</label>
     <div class="layui-input-inline">
		<input type="text"  class="layui-input" autocomplete="off" name="link" />
	 </div>
  </div>	
    <div class="layui-inline">
     <label class="layui-form-label">paixi:</label>
     <div class="layui-input-inline">
		<input type="text"  class="layui-input" autocomplete="off" name="paixi" />
	 </div>
  </div>	
    <div class="layui-inline">
     <label class="layui-form-label">tel:</label>
     <div class="layui-input-inline">
		<input type="text"  class="layui-input" autocomplete="off" name="tel" />
	 </div>
  </div>	
</div>
<div class="layui-form-item" >
<div class="layui-input-block">
      <input type="button" class="layui-btn layui-btn-small" onclick="mjs.search()" value='搜索'>
      <input type="reset" class="layui-btn layui-btn-primary layui-btn-small" value='重置'>
      <input type="button" value="新增" onclick="mjs.editFrom()" class="layui-btn layui-btn-small"/>
</div>
</div>
<div class="layui-form-item" >
      <!-- <input type="button" value="批量删除" onclick="" class="layui-btn layui-btn-danger layui-btn-small"/> -->
 </div>
</form>
	<div id="tablediv">
	<table id="table1" class="layui-table">
	<thead id="thead">
		<tr>
		<th data-name = "id" data-format="buildOperation" style="width:80px;" >操作</th>  
		<th data-name = "title">title</th>  
		<th data-name = "link">link</th>  
		<th data-name = "paixi">paixi</th>  
		<th data-name = "tel">tel</th>  
		</tr>
	</thead>
	</table>
	</div>
	<br>
	<script>
	var mjs  =	mytooljs.initTable({  
		idSelecter:"#table1",
		sendurl:"${path}/user/test/CwLink/showList" , //求数据的地址
		pagesize:5,//分页大小
		title:"CwLink",
		delUrl:"${path}/user/test/CwLink/del",//删除数据地址
		editUrl:"${path}/user/test/CwLink/editForm" //打开编辑或新增页面地址
		});
	
	//操作
	function buildOperation(id,index) {
			var html = "<div class='layui-btn-group'>";
			html+=
				 " <button class='layui-btn layui-btn-small layui-btn-primary' onclick='mjs.editFrom("+ id + ")' >"
				+" <i class='layui-icon'>&#xe642;</i>"
				+" </button>";
			html+= 
				 " <button class='layui-btn layui-btn-small layui-btn-primary' onclick='mjs.delRec("+ id + ")' >"
				+" <i class='layui-icon'>&#xe640;</i>"
				+" </button>"
			    +"</div>";
			return html;
		} 
		layui.use(['form', 'layedit', 'laydate'], function(){
		  var form = layui.form()
		  ,layer = layui.layer
		  ,layedit = layui.layedit
		  ,laydate = layui.laydate;
		  });
	</script>
	</body>
</html>
